from pydantic import BaseModel
from typing import Optional

class CdnNodeBase(BaseModel):
    name: str
    host: str
    ssh_user: Optional[str] = "root"
    ssh_port: Optional[int] = 22
    status: Optional[bool] = True

class CdnNodeCreate(CdnNodeBase):
    pass

class CdnNodeUpdate(BaseModel):
    name: Optional[str]
    host: Optional[str]
    ssh_user: Optional[str]
    ssh_port: Optional[int]
    status: Optional[bool]

class CdnNodeOut(CdnNodeBase):
    id: int

    class Config:
        orm_mode = True
